<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<input type="number" id="input1" />
		<br />
		<select id="select">
			<option value="+">+</option>
			<option value="-">-</option>
			<option value="*">*</option>
		</select>
		<br />
		<input type="number" id="input2" />
		<br />
		<p>结果:<span id="result"></span></p>
		<button onclick="cal()">计算</button>
		<script>
			function cal() {
				var select = document.getElementById("select").value;
				var num1 = document.getElementById("input1").value;
				var num2 = document.getElementById("input2").value;
				var sum;
				console.log(select)
				if(select == "+") {
					sum = parseFloat(num1) + parseFloat(num2);
				} else if(select == "-") {
					sum = parseFloat(num1) - parseFloat(num2);
				} else if(select == "*") {
					sum = parseFloat(num1) * parseFloat(num2);
				}
				document.getElementById("result").innerHTML = sum;
			}
		</script>
	</body>

</html>